//Script Version 2024/05
//Rev 2024.05.27
//
//Initial Pause
pause 150
//
//获取敌人
@getenemy "criminal" "gray" "murderer" "enemy" "closest"

if @inrange "enemy" 12
  attack "enemy"
  headmsg "!!!" 33 "enemy"
  headmsg "!!!" 33 "enemy"
  headmsg "!!!" 33 "enemy"
endif

if not dead "self"
  //自動名誉
  if not @findobject "honored"
    if @hits "enemy" == maxhits "enemy" and @inrange "enemy" 12
      autotargetobject "enemy"
      virtue "honor"

      @setalias "honored" "enemy"
      headmsg "荣誉" 55 'self'
      headmsg "(((   荣誉   )))" 33 "honored"
      headmsg "<<<   荣誉   >>>" 33 "self"
    endif
  endif
  //
  if @inrange "enemy" 12
    //
    //巫术：诅咒武器
    //吸血效果，需要消耗Pig Iron 生命值小于60才使用
    if not buffexists "Curse Weapon" and hits <= 60
      cast "Curse Weapon"
      sysmsg "巫术：诅咒武器 生命<60 吸血效果" 55
      pause 300
    endif
    //
    //骑士精神：神圣武器 
    //造成近战伤害
    if not buffexists "Consecrate Weapon" and mana >= 15
      cast "Consecrate Weapon"
      sysmsg "骑士精神：神圣武器" 55
      pause 300
    endif
  endif
  //
  //骑士精神：死敌
  //对目标造成的近战伤害提升50% 但其他敌人对施法者伤害加倍
  if not buffexists "Enemy of One" and war "self"
    cast "Enemy of One"
    sysmsg "骑士精神：死敌" 55
    pause 300
  endif
endif
//
//骑士精神：反击
//进入防御姿态，当成功格挡时，系统会自动反击，而且不会打断正常的挥击计时器。
  if not buffexists "Counter Attack"
    cast "Counter Attack"
    sysmsg "武士：反击" 55
    pause 100
  endif
//
//特攻
if mana "self" >= 10
  //if mana "self" >= 25
  //第一特攻
  setability "primary" "on"
  //@setability "Secondary" "on"
  sysmsg "主特攻" 55
  pause 100
endif
//
//**********腳本主體 12
//
//**********腳本附加 11
//Minor Add-on <<<
//Timer for Reminder
if not timerexists "T22"
  createtimer "T22"
endif
if timer "T22" >= 5000 and not dead "self"
  //Overloading Reminder
  if diffweight <= 0
    headmsg "*You are overloaded*" 33
  endif
  //
  //Low Stat Warning
  if hits <= 25
    headmsg "* Low HP Warning..." 77
    sysmsg "* Low HP Warning..." 77
  endif
  if stam <= 50
    headmsg "* Low STAM Warning..." 53
    sysmsg "* Low STAM Warning..." 53
  endif
  if mana <= 5
    headmsg "* Low MANA Warning..." 88
    sysmsg "* Low MANA Warning..." 88
    //Animal Chicken
    playsound 110
    playsound 205
    playsound 305
  endif
  //
  //Durability Reminder
  if @property "Durability" "righthand" <= 50 or @property "Durability" "lefthand" <= 50
    headmsg "CHANGE WEAPON" 33
    headmsg "CHANGE WEAPON" 53
    headmsg "CHANGE WEAPON" 73
    sysmsg "CHANGE WEAPON" 33
    sysmsg "CHANGE WEAPON" 53
    sysmsg "CHANGE WEAPON" 73
  endif
  //
  //Vampire
  if graphic "self" != "0x2e9"
    headmsg "Not Vampire." 23
  endif
  //
  settimer "T22" 0
endif
//
//Bag of Sending
if not timerexists "TBG"
  createtimer "TBG"
endif
if timer "TBG" >= 1000 and hits >= 100
  //
  if @findtype "0xe76" "any" "backpack"
    @setalias "bag1" "found"
    if property "Charges" "found" < 1
      if @findtype "0x26b8" "any" "backpack"
        useobject "found"
        waitfortarget 15000
        target! "bag1"
        pause 2000
      else
        sysmsg "* 背包無粉." 38
        headmsg "* 背包無粉." 38
      endif
    endif
  endif
  //
  if diffweight <= 10
    autotargettype "0xeed"
    useobject "bag1"
    pause 1000
    sysmsg "* 使用傳送袋傳送(金錢)" 44
    headmsg "* 使用傳送袋傳送(金錢)" 44
    @canceltarget
    @cancelautotarget
    @cleartargetqueue
  endif
endif
//
//Logout if Died
if not @findobject "pet1"
  promptalias "pet1"
  headmsg "* 點選自己的座騎" 88
endif
if dead "self" and @inrange "pet1" 1
  logoutbutton
endif
//
//**********腳本附加 12
